<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
?>

<!-- JavaScript -->
<script type="text/javascript" src="<?= base_url() ?>js/wufoo.js"></script>
<script src="<?= base_url() ?>js/chosen.jquery.js" type="text/javascript"></script>
<!-- CSS -->
<!--<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/form/form.css" media="screen, tv, projection" title="Default" />-->
<link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>css/datepicker.css" media="screen, tv, projection" title="Default" />
<script type="text/javascript" src="<?= base_url() ?>js/datepicker.js"></script>
<link rel="stylesheet" href="<?php echo base_url() ?>css/chosen.css" />
<script type="text/javascript" src="<?= base_url() ?>js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
	mode : "exact",
    elements : "text_welcome",
	//skin : "o2k7",
	 theme : "advanced",
	theme_advanced_toolbar_location : "top",
	// theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,numlist,|,outdent,indent,|,undo,redo,|,forecolor,backcolor",
	// theme_advanced_buttons2 : "",
	// theme_advanced_buttons3 : ""
	
	});
</script>

<div id="container">
	<?
    //Setting Awal Value Jika Prosedur yang dilakukan adalah prosedur input biasa.
	$value = array(
		'userfile'	=> "",
		'text_keterangan'	=> "",
		'text_welcome'		=> "",
		'legend'				=> "Input Konfigurasi",
		'info'					=> "Input Konfigurasi",
		'act_form'				=> "konfigurasi/input_konfigurasi/"
	);
	$fileold = '';
	//Setting Value pada form Jika melakukan prosedur Edit terhadap data tertentu.
	if($status == "edit"){
		foreach($rs_konfigurasi->result() as $row){
			$value['id_konfigurasi'] = $row->ID_KONFIGURASI;
			$value['userfile'] = $row->URL_LOGO_CETAK;
			$value['text_keterangan'] = $row->TEXT_KETERANGAN;
			$value['text_welcome'] = $row->TEXT_WELCOME;
			$fileold = $row->URL_LOGO_CETAK;
		}
		$value['legend'] = "Edit Konfigurasi";
		$value['info'] = "Edit Konfigurasi";
		$value['act_form'] = "konfigurasi/edit_konfigurasi/".$value['id_konfigurasi'];
	}//end if
	
	?>
	<?= form_open($value["act_form"],'class="wufoo" name="form_konfigurasi" enctype="multipart/form-data"'); ?>
	<fieldset class="fieldset">
	<legend class="legend">
		<?= $value["legend"] ?> |
	</legend>
	
	<div class="info">
		<div><?= $value["info"] ?></div>
	</div>
	<?php if (!empty($err_msg)): ?>
		<div class="ret_error">
			<?php echo $err_msg; ?>
		</div>
	<?php endif; ?>
 <!-- Konten -------------------------------------------------------------------------->
 <div id="contentform">
	<ul>
		<li>
			<label class="desc">Logo Cetak</label><i>Max 500 Kb</i>
			<div>
				<input type="file" name="userfile" size="20" />
				&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>Format : jpg, png, gif (max : 500kb)</b>
			</div>
			<p class="instruct">
				Masukkan Logo Instansi untuk Cetak pada Kolom ini.			
			</p>
		</li>
		<?php echo form_error('userfile'); ?>
		
		<li>
			<label class="desc"></i>
			<div>
				<?// if($fileold != ''){ echo $fileold;}else{ echo '';}?>
				<?if($fileold != ''){?>
					<img width="50" height="50" src="<?= base_url() ?>uploads/konfigurasi/<?= $fileold?>"> <?php echo $fileold?>
				<?}?>
			</div>
		</li>
		
		<li>
			<label class="desc">Keterangan Logo<br><i>Gunakan "[enter]" untuk enter (Tanpa petik).</i></label>
			<div>
				<textarea rows="5" cols="100" name="text_keterangan" value="<? if(set_value('text_keterangan')!='') echo set_value('text_keterangan'); else echo $value['text_keterangan'];?>"><?php echo str_replace("<br>", "[enter]",$value['text_keterangan'])?></textarea>
			</div>
			<p class="instruct">
				Masukkan Keterangan Logo Pada Kolom ini.			
			</p>
		</li>
		<?php echo form_error('text_keterangan'); ?>
		
		<li>
			<label class="desc">Teks Welcome</label>
			<div>
				<textarea rows="5" cols="100" name="text_welcome" value="<? if(set_value('text_welcome')!='') echo set_value('text_welcome'); else echo $value['text_welcome'];?>"><?php echo $value['text_welcome']?></textarea>
			</div>
			<p class="instruct">
				Masukkan Teks Welcome Pada Kolom ini.			
			</p>
		</li>
		<?php echo form_error('text_welcome'); ?>
		
		<input type="hidden" id="fileold" name="fileold" value="<?=$value['userfile']?>">
		<li class="buttons">
		  <input id="saveForm" class="btTxt" type="submit" value="Simpan" />
		  <input name="submit" type="reset" value="Batal" />
		</li>
	</ul>
</div>
</fieldset>	
<?= form_close(); ?>
</form>
</div><!--container-->